<!DOCTYPE html>
<html lang="zh">
<head>
  <meta charset="utf-8">
  <title>OpenLayers 图片叠加示例</title>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/ol@v7.4.0/ol.css">
  <style>
    html, body, #map { width: 100%; height: 100%; margin: 0; }
  </style>
</head>
<body>
<div id="map"></div>
<script src="https://cdn.jsdelivr.net/npm/ol@v7.4.0/dist/ol.js"></script>
<script>
  // 设定图片的地理范围（左下角和右上角经纬度）
  const imageExtent = [73.5, 3.8, 135.1, 53.6];

  // 创建图片图层
  const imageLayer = new ol.layer.Image({
    source: new ol.source.ImageStatic({
      url: 'img-2025-01-10-16.png', // 图片路径
      imageExtent: imageExtent,
      projection: 'EPSG:4326'
    })
  });

  // 创建地图
  const map = new ol.Map({
    target: 'map',
    layers: [
      // 底图（OpenStreetMap）
      new ol.layer.Tile({
        source: new ol.source.OSM()
      }),
      // 叠加图片
      imageLayer
    ],
    view: new ol.View({
      projection: 'EPSG:4326',
      center: [(imageExtent[0] + imageExtent[2]) / 2, (imageExtent[1] + imageExtent[3]) / 2],
      zoom: 4,
      minZoom: 3,
      maxZoom: 10
    })
  });
</script>
</body>
</html>